#include <QtGui>
#include "maindialog.h"

#include "version.h"
#include "processwrapper.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // put version to the registry
    QSettings reg(QSettings::UserScope, "Sintegrial", "KeySwitch");
    reg.setValue("Version", version);
    reg.setValue("VersionTxt", version_txt);

    // check single run
    unsigned int pid = ProcessWrapper::findProcess("keyconfig",
                                                   ProcessWrapper::currentProcessId());
    if (pid) {
      // switch to pid
      ProcessWrapper::activateProcess(pid);
      return 1;
    }

    MainDialog w;
    w.show();
    return a.exec();
}
